package CaseTraining;

import java.util.Random;
import java.util.Scanner;

public class CaseDemo06 {
    public static void main(String[] args) {
        int[] money = {33, 99, 666, 520 ,1314, 77};
        start(money);
    }
    public static void start(int[] moneys){
        //money[] = {11,22,34,66,97}
        Scanner sc = new Scanner(System.in);
        Random r = new Random();
        for (int i = 0; i < moneys.length; i++) {
            System.out.println("请您输入任意内容进行抽奖：");
            sc.next();
            //随机一个数组长度以内的数赋值给index
            int index = r.nextInt(moneys.length - 1);
            int money = moneys[index];
            //随机到的位置赋值一个0
            do {
                    System.out.println("恭喜您抽中红包：" + money + "元");
                    moneys[index] = 0;
                    break;
                }while (money == 0) ;
            }
        System.out.println("活动结束啦");
    }
}

